package com.mayikt.zuul.handler.factory;

import com.mayikt.core.utils.SpringContextUtil;
import com.mayikt.zuul.handler.GatewayHandler;

/**
 * 工厂Handler
 * 
 * 
 * @description:
 * @author: 97后互联网架构师-余胜军
 * @contact: QQ644064779、微信yushengjun644 www.mayikt.com
 * @date: 2019年1月3日 下午3:03:17
 * @version V1.0
 * @Copyright 该项目“基于SpringCloud2.x构建微服务电商项目”由每特教育|蚂蚁课堂版权所有，未经过允许的情况下，
 *            私自分享视频和源码属于违法行为。
 */
public class FactoryHandler {

	public static GatewayHandler getHandler() {
		// 1.黑名单拦截
		GatewayHandler handler1 = (GatewayHandler) SpringContextUtil.getBean("blacklistHandler");
		// 2.验证accessToken
		GatewayHandler handler2 = (GatewayHandler) SpringContextUtil.getBean("apiAuthorityHandler");
		handler1.setNextHandler(handler2);
		// 3.API接口参数接口验签
		GatewayHandler handler3 = (GatewayHandler) SpringContextUtil.getBean("toVerifyMapHandler");
		handler2.setNextHandler(handler3);
		return handler1;
	}

}
